			var btn = document.querySelector(".btn");
			var content = document.querySelector(".content");
			var box = document.querySelector(".box");
			var game = document.querySelector(".game");
			var customsPass = document.querySelector(".customsPass");
			var gameOver = document.querySelector(".gameOver")
			var btns = document.querySelector(".gameOver .btns")
			var scores = document.querySelector(".gameOver p")
			var guanqia  = document.querySelector(".gameOver span")
			
			btn.addEventListener("click",function(){
				content.style.display = "none";
				gameOver.style.display = "none";
//				content.style.left = "-605px";
				customsPass.style.left = "-605px";
				getCircle();
			})
			
//			btn.addEventListener("click",function(){
//				content.style.display = "inherit";
//				gameOver.style.display = "inherit";
//			})
			function bump(obj01,obj02){
//				用变量将信息存起来,减少不必要的函数调用,提高性能
				var obj01Info = obj01.getBoundingClientRect();
				var obj02Info = obj02.getBoundingClientRect();
				var t1 = obj01Info.top,
					l1 = obj01Info.left,
					r1 = obj01Info.right,
					b1 = obj01Info.bottom;
				
				var t2 = obj02Info.top,
					l2 = obj02Info.left,
					r2 = obj02Info.right,
					b2 = obj02Info.bottom;
					
				if(r1 < l2 || l1 > r2 ||  t1 > b2 || b1 < t2){
					console.log("没有碰到");
					return false;
				}else{
					console.log("碰到了");
					return true;
				}
			}
			
//			随机生成圆
			function getCircle(){
				var div = document.createElement("div");
				var clientW = game.clientWidth;
				var clientH = game.clientHeight;
//				随机生成球的宽高,且直径不小于15
				var divW = divH = Math.floor(Math.random()*60 + 25);
//				随机生成top值,left值
				var divT = Math.floor(Math.random()*clientH);
				var divL = Math.floor(Math.random()*clientW);
//				防止超出屏幕,如果超出最大top/left，则让球贴边
				divT > clientH - divH ? divT = clientH - divH : '';
				divL > clientW - divW ? divL = clientW - divW : '';
//				console.log(divW,divH);
				
				div.style.width = `${divW}px`;
				div.style.height = `${divH}px`;
				div.style.top = `${divT}px`;
				div.style.left = `${divL}px`;
				div.style.borderRadius = "50%";
				div.style.backgroundColor = "white";
				div.style.position = "absolute";
//				console.log(div.style)
				div.classList.add("lastOne");
				game.appendChild(div);
				return div;
			}
			
			
			game.addEventListener("click",function(event){
//				console.log(event.target);
//				判断是否为最后一个,是则创建新圆并进行检测,否则游戏结束
				
				if(event.target.classList.contains("lastOne")){
					event.target.classList.remove("lastOne");
					console.log("最后一个球")
					
					var allBall = document.querySelectorAll(".game div");
					setTimeout(function() {
						var newCircle = getCircle();
						(function check(target){
							allBall.forEach((e,index)=>{
								if(bump(e,target)){
									target.remove();
									var newCircle = getCircle();
									check(newCircle);
								}
							})
						}(newCircle));
					},1000)
					
//					计算关卡
					var sumb = document.querySelector(".customsPass .sumb");
					allBall.forEach((e,index)=>{
						sumb.innerText = index+2;
					})
					if(customsPass.style.left == "-605px"){
						customsPass.style.transition = "all 3s";
						customsPass.style.left = "605px";
					}else{
						customsPass.style.transition = "all 3s";
						customsPass.style.left = "-605px";
					}
					
				}else if(!event.target.classList.contains("game")){
//					console.log(event.target)
					var allBall = document.querySelectorAll(".game div");
					allBall.forEach((e,index)=>{
						if(e.classList.contains("lastOne")){
//							为结束前的最后一个球添加闪烁动画
							e.classList.add("blink");
							scores.innerText = "SCORE:"+index*10;
							guanqia.innerText = "你在第"+(index+1)+"关扑街了";
							console.log(index);
						}
					})
					setTimeout(function() {
//						alert("游戏结束")
						gameOver.style.display = "inherit";
					}, 1600);
					return
				}
			});
			

